package pp.gateway.domain.video.download;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import pp.infrastructure.exception.PPException;
import pp.infrastructure.exception.PPExceptionInfo;
import pp.infrastructure.mysql.mapper.video.VideoMapper;
import pp.infrastructure.mysql.mapper.video.VideosDo;

@Repository
@Slf4j
public class VideoWriter {

    @Autowired
    VideoMapper mapper;

    public boolean insert(VideosDo input) {
        //参数检查
        if(!mapper.addVideo(input)){
            log.error("{}.{} --> {};", this.getClass().getName(), new Object(){}.getClass().getEnclosingMethod().getName()
                    , "保存视频基础信息出错，系统异常");
            throw new PPException(PPExceptionInfo.GENERIC_SYSTEM_INNER_PARAM_INVALID);
        }
        return true;
    }
}
